<template>
  <view class='container'>
    <!-- <u-navbar title="设置" height="48px" :autoBack="true" /> -->
    <view class="setting user-setting" >
			<u-cell title="编辑资料" isLink url="/pages/setting/profile/index" />
			<u-cell title="账号安全" isLink url="/pages/setting/account/index" />
			<u-cell title="隐私设置" isLink url="/pages/setting/privacy/index" />
    </view>
    <view class="setting basic-setting">
			<u-cell title="夜间模式"  >
				<view slot="value">
					<u-switch v-model="switchoverStatus" @change="switchoverChange"></u-switch>
				</view>
			</u-cell>
			<u-cell title="大字设置" isLink />
			<u-cell title="字体大小" isLink value="小" />
    </view>
    <view class="setting">
			<u-cell title="清除缓存" isLink  value="0B" />
			<u-cell title="播放与网络设置" isLink  />
			<u-cell title="推送通知设置" isLink  />
			<u-cell title="安全浏览设置" isLink />
			<u-cell title="提示音开关"  >
				<view slot="value" >
					<u-switch v-model="promptStatus" @change="promptChange"></u-switch>
				</view>
			</u-cell>
    </view>
    <view class="setting">
			<u-cell title="隐私政策及简明版" isLink />
			<u-cell title="个人信息收集清单" isLink  />
			<u-cell title="第三方信息共享清单" isLink  />
			<u-cell title="安全浏览设置" isLink />
    </view>
    <view class="setting">
			<u-cell title="检查版本" isLink  :value="appVersion" />
			<u-cell title="关于头条" isLink  />
			<u-cell title="用户反馈" isLink  />
		</view>
    <view class="login-out" v-if="token">
			<u-button text="退出登录" type="default" @click="onExit()"></u-button>
    </view>
		
   </view>
</template>

<script>
import { mapActions, mapGetters } from 'vuex'
import {getStorage} from '@/utils/storage'
export default {
  name: 'Setting',
  components: {
  },
  data () {
    return {
      promptStatus: false,
      switchoverStatus: false,
			appVersion:null
    }
  },
	onReady(){
		// 获取app版本号
		this.appVersion  = getStorage('systemInfo').appVersion
	},
	
  computed: {
    ...mapGetters(['token'])
  },
  methods: {
    ...mapActions('user', ['logout']),
		promptChange(e){
			this.promptStatus = e
		},
		switchoverChange(e){
			this.switchoverStatus = e
		},
    onExit () {
      this.logout()
      this.$router.back()
    }
  }
}
</script>
<style lang="scss" scoped>
.container{
  background-color:rgb(240, 240, 240);
	padding-bottom: 20rpx;
}
.setting{
  margin-top: 8px;
	background-color: #fff;
}
.user-setting{
	// margin-top: 95px;
}
.login-out{
  margin-top: 15px;
 background-color: #fff;
 color: #218eff;
}
</style>
